import axios from 'axios';

const API_BASE_URL = 'http://114.55.138.69:5000/api'

// 对该用户来说 -- 被举报 | 申诉 对应相同 id 事件
export const getReportedEvents = async (userId) => {
    try {
        const response = await axios.get(`${API_BASE_URL}/reported/${userId}`);
        return response.data.reported_against_events;
    } catch (error) {
        console.error("Error fetching reported against events:", error);
        throw error;
    }
};


// 被举报方标记已读
export const markReportedEventRead = async (eventId) => {
    try {
        const response = await axios.post(`${API_BASE_URL}/reported_mark_read/${eventId}`);
        return response.data;
    } catch (error) {
        console.error('标记被举报事件已读失败:', error);
        throw error;
    }
};

// 被举报方收藏/取消收藏
export const toggleReportedEventFavorite = async (eventId) => {
    try {
        const response = await axios.post(`${API_BASE_URL}/reported_collected/${eventId}`);
        return response.data;
    } catch (error) {
        console.error('切换被举报事件收藏状态失败:', error);
        throw error;
    }
};
